//夜间模式切换
function switchNightMode() {
    var night = document.cookie.replace(/(?:(?:^|.*;\s*)night\s*\=\s*([^;]*).*$)|^.*$/, "$1") || '0';
    if (night == '0') {
        document.body.classList.add('black');
        document.getElementById("fk_service_text").innerHTML = "切换日间模式";
        document.cookie = "night=1;path=/";
        iziToast.info({
            timeout: 2000, //调试
            icon: 'iconfont',
            closeOnEscape: 'true',
            transitionOut: 'fadeOutRight',
            displayMode: 'replace',
            layout: '2',
            transitionIn: 'bounceInLeft',
            position: 'topRight',
            icon: 'iconfont icon-moon',
            backgroundColor: '#fff',
            title: '夜间模式切换',
            message: '已切换为夜间模式'
        });
    } else {
        document.body.classList.remove('black');
        document.getElementById("fk_service_text").innerHTML = "切换夜间模式";
        document.cookie = "night=0;path=/";
        iziToast.info({
            timeout: 2000, //调试
            icon: 'iconfont',
            closeOnEscape: 'true',
            transitionOut: 'fadeOutRight',
            displayMode: 'replace',
            layout: '2',
            transitionIn: 'bounceInLeft',
            position: 'topRight',
            icon: 'iconfont icon-sun',
            backgroundColor: '#fff',
            title: '日间模式切换',
            message: '已切换为日间模式'
        });
    }
}

//回到顶部
window.onscroll = function () {
    if (document.documentElement.scrollTop + document.body.scrollTop > 100) {
        document.getElementById("topup").style.display = "block";
        document.getElementById("navbar").style.cssText = "backdrop-filter: blur(20px); background: rgba(255,255,255,.8); box-shadow: 0 5px 20px rgb(0 0 0 / 5%); transition: 0.5s;";
    } else {
        document.getElementById("topup").style.display = "none";
        document.getElementById("navbar").style.cssText = "backdrop-filter: none; background: transparent; box-shadow: none; transition: 0.5s;";
    }
}